//
//  WJPopupManager.swift
//  PDFSign
//
//  Created by 李永彬 on 2025/9/20.
//

import UIKit

class WJPopupManager {
    static let shared = WJPopupManager()
    
    private init() {}
    
    // 显示底部弹窗
    func showBottomPopup(title: String,
                        message: String,
                        confirmText: String = "确认",
                        cancelText: String = "取消",
                        onConfirm: (() -> Void)? = nil,
                        onCancel: (() -> Void)? = nil) {
        let popup = WJBottomPopupView()
        popup.configure(title: title, message: message, confirmText: confirmText, cancelText: cancelText)
        popup.onConfirm = onConfirm
        popup.onCancel = onCancel
        popup.setupContent()
        popup.show(animationStyle: .fromBottom)
    }
    
    // 显示中间弹窗
    func showCenterPopup(title: String,
                        message: String,
                        actionText: String = "立即操作",
                        onAction: (() -> Void)? = nil) {
        let popup = WJCenterPopupView()
        popup.configure(title: title, message: message, actionText: actionText)
        popup.onAction = onAction
        popup.setupContent()
        popup.show(animationStyle: .fromCenter)
    }
    
    // 显示自定义弹窗
    func showCustomPopup(_ popup: WJBasePopupView, animationStyle: WJPopupAnimationStyle = .fromBottom) {
        popup.setupContent()
        popup.show(animationStyle: animationStyle)
    }
}
